<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <RootNamespace>System.Resources.Tests</RootNamespace>
    <BinPlaceSatelliteAssemblies>true</BinPlaceSatelliteAssemblies>
    <TestRuntime>true</TestRuntime>
    <IncludeRemoteExecutor>true</IncludeRemoteExecutor>
    <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix</TargetFrameworks>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="MissingManifestResourceExceptionTests.cs" />
    <Compile Include="Resources\AToZResx.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>AToZResx.resx</DependentUpon>
    </Compile>
    <Compile Include="TrimCompatibilityTests.cs" />
    <Compile Include="NeutralResourcesLanguageAttributeTests.cs" />
    <Compile Include="ResourceManagerTests.cs" />
    <Compile Include="Resources\TestResx.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>TestResx.resx</DependentUpon>
    </Compile>
    <Compile Include="SatelliteContractVersionAttributeTests.cs" />
    <Compile Include="MissingSatelliteAssemblyException.cs" />
    <Compile Include="ResourceSetTests.cs" />
    <Compile Include="$(CommonTestPath)System\Drawing\Helpers.cs" Link="Common\System\Drawing\Helpers.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\AToZResx.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>AToZResx.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\TestResx.netstandard17.resources">
      <WithCulture>false</WithCulture>
      <Type>Non-Resx</Type>
    </EmbeddedResource>
    <_WorkaroundCoreMSBuildResource Include="Resources\TestResx.netstandard17.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>TestResx.netstandard17.Designer.cs</LastGenOutput>
    </_WorkaroundCoreMSBuildResource>
    <Compile Include="Resources\TestResx.netstandard17.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>TestResx.netstandard17.resx</DependentUpon>
    </Compile>
    <EmbeddedResource Include="Resources\TestResx.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>TestResx.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\TestResx.es.resx" />
    <EmbeddedResource Include="Resources\TestResx.es-MX.resx" />
    <EmbeddedResource Include="Resources\TestResx.fr-FR.resx" />
    <EmbeddedResource Include="Resources\TestClassWithoutNeutralResources.fr.resx" />
    <EmbeddedResource Include="Resources\CustomReader.resx" />
    <Content Include="Resources\TestResx.netstandard17.resources" Link="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" Visible="false" />
    <Content Include="Resources\bitmap.bmp" Link="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" Visible="false" />
    <Content Include="Resources\icon.ico" Link="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" Visible="false" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" />
    <!--Reference to System.Resources.Extensions is required in order to be able to embed a resource that requires a custom reader-->
    <ProjectReference Include="$(LibrariesProjectRoot)System.Resources.Extensions\src\System.Resources.Extensions.csproj" />
  </ItemGroup>
  <!--
    MSBuild on .NET Core doesn't support non-string resources. See https://github.com/Microsoft/msbuild/issues/2221
    Workaround this for now by invoking the desktop resgen.exe on Windows manually to regenerate the resource files.
  -->
  <Target Name="RegenerateNonStringResources">
    <PropertyGroup>
      <_ResourceRelativeDir>%(_WorkaroundCoreMSBuildResource.RelativeDir)</_ResourceRelativeDir>
      <_ResourceRelativeDir>$(_ResourceRelativeDir.TrimEnd('\'))</_ResourceRelativeDir>
      <_ResourceOutputName>$(_ResourceRelativeDir)\%(_WorkaroundCoreMSBuildResource.FileName).resources</_ResourceOutputName>
    </PropertyGroup>

    <Exec Command="resgen.exe %(_WorkaroundCoreMSBuildResource.Identity) $(_ResourceOutputName)" />
  </Target>
</Project>
